const path = require("path");

module.exports = {
  publicPath: "./",
  runtimeCompiler: true,
  css: {
    loaderOptions: {
      // 给 less-loader 传递选项
      less: {
        javascriptEnabled: true,
      },
    },
  },
  configureWebpack: {
    resolve: {
      alias: {
        "@lib": path.resolve(__dirname, "./lib"),
        "@util": path.resolve(__dirname, "./lib/_util"),
        "@style": path.resolve(__dirname, "./lib/styles"),
        "@img": path.resolve(__dirname, "./lib/img"),
      },
    },
    module: {
      rules: [
        {
          test: /\.md$/,
          use: [
            {
              loader: "vue-loader",
              options: {
                compilerOptions: {
                  preserveWhitespace: false,
                },
              },
            },
            {
              loader: path.resolve(__dirname, "./src/loader/index.js"),
            },
          ],
        },
      ],
    },
    performance: {
      hints: "warning",
      maxEntrypointSize: 50000000,
      maxAssetSize: 30000000,
      assetFilter(assetFilename) {
        return assetFilename.endsWith(".js");
      },
    },
  },
  chainWebpack: (config) => {
    //忽略的打包文件
    config.externals({
      vue: "Vue",
      "vue-router": "VueRouter",
      "element-ui": "ELEMENT",
    });
  },
};
